/* eslint-disable */
// @ts-ignore
import request from '@/utils/request';
import { CustomRequestOptions } from '@/interceptors/request';

import * as API from './types';

/** 获取OSS配置 GET /common/oss */
export async function commonGet({
  options,
}: {
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelOssKeyModel_>('/common/oss', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取产品小程序码 POST /common/wei_xin_code */
export async function commonWeiXinCode({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.CommonWeiXinCodeParams;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelUnlimitedCodeModel_>('/common/wei_xin_code', {
    method: 'POST',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 微信快捷登录 POST /common/wei_xin_login */
export async function commonWeiXinLogin({
  body,
  options,
}: {
  body: API.RequestWeiXinLoginModel;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelUserCenterLoginModel_>(
    '/common/wei_xin_login',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    }
  );
}

/** 微信分享签名 POST /common/wei_xin_sign */
export async function commonWeiXinSign({
  body,
  options,
}: {
  body: API.RequestWeiXinSignModel;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelWeiXinSignModel_>('/common/wei_xin_sign', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
